package com.vercon.otamirror.dialog;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import com.vercon.commonmirror.base.BaseDialogFragment;
import com.vercon.otamirror.R;

/**
 * Created by csh on 2020/11/21
 * 取消更新
 */
public class CancelUpdateDialog extends BaseDialogFragment {

    private OnDialogListener mDialogListener;

    @Override
    protected int setContentView(@Nullable Bundle savedInstanceState) {
        return R.layout.dialog_cancel_update;
    }

    @Override
    protected void initView(View view) {
//        setCancelable(false);
    }

    public void setOnDialogListener(OnDialogListener listener) {
        mDialogListener = listener;
    }

    public interface OnDialogListener {
        void onCancel();
    }

    @Override
    protected void initListener(View view) {
        view.findViewById(R.id.btn_cancel).setOnClickListener(v -> {
            dismiss();
            if (mDialogListener != null) {
                mDialogListener.onCancel();
            }

        });
        view.findViewById(R.id.btn_commit).setOnClickListener(v -> {
            dismiss();
        });
    }

    @Override
    protected boolean isFullScreen() {
        return true;
    }

}